<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改系列')" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-series-edit" th:object="${series}">
			<input id="seriesId" name="seriesId" type="hidden" th:field="*{seriesId}"/>
			<div class="form-group">
				<label class="col-sm-3 control-label">系列名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="seriesName" id="seriesName" th:field="*{seriesName}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">系列备注：</label>
				<div class="col-sm-8">
					<textarea id="seriesDesc" name="seriesDesc" class="form-control">[[*{seriesDesc}]]</textarea>
				</div>
			</div>
		</form>
	</div>
	<th:block th:include="include :: footer" />
	<script type="text/javascript">
		var prefix = ctx + "product/series";
		
		$("#form-series-edit").validate({
			onkeyup: false,
			rules:{
				seriesName:{
					remote: {
		                url: ctx + "product/series/checkSeriesNameUnique",
		                type: "post",
		                dataType: "json",
						data: {
							"seriesName" : function() {
								return $.common.trim($("#seriesName").val());
							}
						},
						dataFilter: function(data, type) {
							return $.validate.unique(data);
						}
		            }
				},
			},
			messages: {
				"seriesName": {
					remote: "系列名称已经存在"
				},
		    },
		    focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	        	$.operate.save(prefix + "/edit", $('#form-series-edit').serialize());
	        }
	    }
	</script>
</body>
</html>
